int readPinAnalog = 2; //You can make up any name for your pins here int writePinPwm = 7; void setup() { pinMode(readPinAnalog, INPUT); //stating that the phototransistor will be input pinMode(writePinPwm, OUTPUT); //stating that the LED will be output } void loop() { // cycle functions below int readAnalogValue = analogRead(readPinAnalog); //stating that the MC should read the value of pin 2 int tmp = readAnalogValue; // storing the value of pin 2 analogWrite(writePinPwm,tmp); //give the value as input for pin 7 delay(100); //a new cycle every 100 ms } // end of cycle functions